from django.db import models

# Create your models here.


class TestImageTable(models.Model):
    class Meta:
        db_table = "test_images"
        verbose_name = "图片测试表"
        verbose_name_plural = verbose_name
        ordering = ("-create_datetime",)

    name = models.CharField(max_length=64, null=True, blank=True, verbose_name="名称", help_text="名称")
    img = models.ImageField(upload_to='zzz', verbose_name="图片", help_text="图片", null=True, blank=True)
    mime_type = models.CharField(max_length=100, null=True, blank=True, verbose_name="Mime类型", help_text="Mime类型")
    md5 = models.CharField(max_length=36, blank=True, null=True, verbose_name="文件md5", help_text="文件md5")
    create_datetime = models.DateTimeField(auto_now_add=True, verbose_name="创建时间", null=True, blank=True, help_text="创建时间")
    size = models.BigIntegerField(default=0, blank=True, null=True, verbose_name="文件大小", help_text="文件大小")
    file = models.FileField(upload_to='zzz', verbose_name="文件", help_text="文件", null=True, blank=True)


class TestUserTable(models.Model):

    class Meta:
        db_table = "user_table"
        verbose_name = "用户测试表"
        verbose_name_plural = verbose_name
        ordering = ("-id",)

    name = models.CharField(max_length=64, verbose_name="名称", help_text="名称")
    value = models.CharField(max_length=128, verbose_name="值", help_text="值", null=True, blank=True)
    user = models.ForeignKey(to='system.Users', on_delete=models.CASCADE, verbose_name="用户", help_text="用户")


